<template>
  <el-row :gutter="24">
    <el-col :span="6" v-if="mdl.moralityPlanTargetList && mdl.moralityPlanTargetList.length > 0">
      <el-card shadow="never" :class="['overflow-card', computedClass('card1')]">
        <div slot="header" class="tl-center">
          <span>考评对象</span>
        </div>
        <ul ref="card1">
          <li
            class="mb20"
            v-for="(item,index) in mdl.moralityPlanTargetList"
            :key="index"
          >{{ index+1 + '.' }} {{item.name}}</li>
        </ul>
      </el-card>
    </el-col>
    <el-col :span="6" v-if="mdl.moralityPlanItemList && mdl.moralityPlanItemList.length > 0">
      <el-card shadow="never" :class="['overflow-card', computedClass('card2')]">
        <div slot="header" class="tl-center">
          <span>考评内容</span>
        </div>
        <ul ref="card2">
          <li
            class="mb20"
            v-for="(item,index) in mdl.moralityPlanItemList"
            :key="index"
          >{{ index+ 1 + '.' }} {{item.moralityItemName}}</li>
        </ul>
      </el-card>
    </el-col>
    <el-col :span="6" v-if="mdl.moralityPlanItemList1 && mdl.moralityPlanItemList1.length > 0">
      <el-card shadow="never" :class="['overflow-card', computedClass('card3')]">
        <div slot="header" class="tl-center">
          <span>加减分项目</span>
        </div>
        <ul ref="card3">
          <li
            class="mb20"
            v-for="(item,index) in mdl.moralityPlanItemList1"
            :key="index"
          >{{ index+ 1 + '.' }} {{item.evalItemName}}</li>
        </ul>
      </el-card>
    </el-col>
    <el-col :span="6">
      <el-card shadow="never" :class="['overflow-card',computedClass('card4')]">
        <div slot="header" class="tl-center">
          <span>考评等级</span>
        </div>
        <ul ref="card4">
          <li v-for="(item,index) in mdl.moralityPlanLevels" :key="index">
            <p>{{ index+ 1 }}. 等级名称：{{item.moralityLevelName}}</p>
            <p>最大值：{{ item.maxScore }}</p>
            <p>最小值：{{ item.minScore }}</p>
            <p>{{ item.peopleLimit === 1 ? '限制人数比例' : '不限制人数比例' }}</p>
          </li>
        </ul>
      </el-card>
    </el-col>
  </el-row>
</template>

<script>
export default {
  data() {
    return {
      mdl: {}
    }
  },
  methods: {
    computedClass(ref) {
      this.$nextTick(() => {
        // console.log('offsetHeight', this.$refs[ref])
        return { 'overflow-card': true, 'overY-Scroll': this.$refs[ref].offsetHeight > 310 }
      })
    },
    show(obj) {
      console.log(obj)
      this.mdl = obj
    }
  }
}
</script>
